// import request from 'umi-request';
import request from '@/utils/request';
export async function queryRule(params) {
    const limit = params.pageSize;
    const page = params.current;
    const my_params = {
        limit: limit,
        page: page,
    };
    Object.assign(params, my_params);
    return request('/factory/terminal/device/page', {
        params,
    });
}

export async function queryModelRule() {
    const my_params = {
        limit: 10000,
        page: 1,
    };
    return request('/factory/terminal/model/page', {
        my_params,
    });
}
export async function queryCommunityStreetRule(params) {
    return request('/factory/system/communityStreet/tree', {
        params,
    });
}
// export async function queryModuleRule(params) {
//   return request(`/factory/terminal/serviceModule/${params}`);
// }
export async function queryModuleInitRule(params) {
    return request('/factory/terminal/serviceModule', {
        params,
    });
}
export async function removeRule(params) {
    return request('/api/rule', {
        method: 'POST',
        data: {
            ...params,
            method: 'delete'
        },
    });
}
export async function addRule(params) {
    return request('/factory/terminal/device', {
        method: 'POST',
        data: {
            ...params
        },
    });
}
export async function updateRule(params) {
    return request('/factory/terminal/device', {
        method: 'PUT',
        data: {
            ...params
        },
    });
}
export async function editDeviceContent(params) {
    return request('/factory/terminal/device/build', {
        method: 'POST',
        data: params,
    });
}
export async function editDeviceArea(params) {
    return request('/factory/terminal/device', {
        method: 'PUT',
        data: {
            ...params
        },
    });
}